package com.xinzhi.savingpot.search.configure;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;

@Configuration
@EnableSolrRepositories(schemaCreationSupport = true,basePackages="com.")
public class SolrConfig {

    @Value("${spring.data.solr.host}") //读取solr的地址
    private String host;
    @SuppressWarnings("deprecation")
    @Bean
    public SolrClient solrClient() {
        return new HttpSolrClient.Builder(host).build(); //生成solrClient 交给spring容器进行管理
    }


}